// import Watcher from "../core/observer/watcher";
import { initMixin } from "./init";
import Watcher from "./observer/watcher";

function abstrctmethod() {
  throw new Error('[rcad]: 抽象方法')
}
// export default function Entity() {
//   throw new Error('[rcad]: 不能创建Entity实例')
// }
// Entity.prototype.render = abstrctmethod;
// Entity.prototype.setCtx = abstrctmethod;
// Entity.zero = 0;
export default class Entity {
  constructor(options) {
    this.$options = options;
    this.$ctx = null;
    this.$eventMap = new Map();   // event collect
    this.$dragging = false;
    this.$entity = options.entity
    // 数据响应式和四个事件
    this._init();
  }

  subscribe(updateFn) {
    const ist = this;
    // new Watcher(vm, 'X', val => {
    //   updateFn(val);
    // });
    // new Watcher(ist, 'startPt', val => {
    //   const valStr = val.toString();
    //   // console.log('startPt值修改：', val);
    //   updateFn(valStr);
    // });
    new Watcher(ist, 'endPt', val => {
      const valStr = val.toString();
      // console.log('startPt值修改：', val);
      updateFn(valStr);
    });
    // new Watcher(ist, 'endPt', val => {
    //   console.log('endPt值修改：', val);
    // });
    // new Watcher(ist, 'length', val => {
    //   console.log('length值修改：', val);
    // });
    // new Watcher(ist, 'color', val => {
    //   console.log('color值修改：', val);
    // });

  }

  

}
initMixin(Entity)